<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="container">

    {{ baidu }}
    <baidu-href v-bind:url="baidu"></baidu-href>
</div>

<script src="https://unpkg.com/vue@next"></script>
<script type="text/javascript">

    const demoApp = {
        data() {
            return {
                baidu: 'http://www.baidu.com'
            }
        },
        mounted() {

        },
        methods: {}

    }

    const app = Vue.createApp(demoApp)

    app.component('baidu-href', { // 命名很奇怪，baiduHref这样就不起作用
        props: ['url'], // 自定义组件定义的属性
        template: "<a v-bind:href='url'>link</a>"
        // template: "<a v-bind:href='{{url}}'>link</a>"
        // template: "<a href='{{url}}'>link</a>" 只有在text interpolation才起作用，属性时不能这样做。
    })

    app.mount('#container')
</script>

</body>
</html>
